{template 'header'}
<div class="page store-detail" id="page-app-store">
	<header class="bar bar-nav">
		<a class="icon fa fa-arrow-left pull-left back" href="javascript:;"></a>
		<h1 class="title">配送点详情</h1>
		<a class="icon fa pull-right {if !empty($is_favorite)}fa-favor-fill{else}fa-favor{/if}" href="javascript:;" id="btn-favorite" data-id="{$store['id']}" data-uid="{$_W['member']['uid']}"></a>
	</header>
	{template 'nav'}
	<div class="content">
		{if !empty($store['thumbs'])}
		<div class="swiper-container swiper-container-horizontal" data-space-between='30' data-pagination='.swiper-pagination' data-autoplay="2000">
			<div class="swiper-wrapper">
				{loop $store['thumbs'] $thumb}
				<div class="swiper-slide" data-link="{$thumb['url']}">
					<img src="{php echo tomedia($thumb['image']);}"alt="">
				</div>
				{/loop}
			</div>
			<div class="swiper-pagination"></div>
		</div>
		{/if}
		<div class="row no-gutter banner">
			<div class="col-33 text-center">
				<img src="{php echo tomedia($store['logo']);}" alt="" class="logo"/>
			</div>
			<div class="col-67">
				<div class="goods-title">{$store['title']}</div>
				<div class="star-rank">
					<span class="star-rank-outline">
						<span class="star-rank-active" style="width:{$store['score_cn']}%"></span>
						<span class="star-rank-value">{$store['score']}</span>
					</span>
				</div>
				<div class="sell-info">已售:{$store['sailed']}份</div>
			</div>
		</div>
		<div class="row no-gutter delivery-info">
			<div class="col-33">起送价￥{$store['send_price']}</div>
			<div class="col-33">配送￥{$store['delivery_price']}</div>
			<div class="col-33">送达时长{$store['delivery_time']}分钟</div>
		</div>
		<div class="grid-nav grid-money">
			<div class="grid-money-title">
				配送服务
			</div>
			<div class="row no-gutter">
				<div class="col-25">
					<a href="{php echo $this->createMobileUrl('goods', array('sid' => $sid));}" class="external">
						<i class="fa fa-takeout"></i>
						<span>去下单</span>
					</a>
				</div>
				{if $store['is_meal'] == 1}
					<div class="col-25">
						<a href="javascript:;" id="scanqrcode">
							<i class="fa fa-meal"></i>
							<span>堂食</span>
						</a>
					</div>
				{/if}
				{if $store['is_reserve'] == 1}
					<div class="col-25">
						<a href="{php echo $this->createMobileUrl('reserve', array('sid' => $sid));}" class="external">
							<i class="fa fa-reserve"></i>
							<span>预定</span>
						</a>
					</div>
				{/if}
				{if $store['is_assign'] == 1}
					<div class="col-25">
						<a href="{php echo $this->createMobileUrl('assign', array('sid' => $sid));}" class="external">
							<i class="fa fa-assign"></i>
							<span>排号</span>
						</a>
					</div>
				{/if}
			</div>
		</div>
		{if !empty($store['custom_url'])}
		<div class="list-block">
			<ul>
				{loop $store['custom_url'] $row}
				<li>
					<a href="{$row['url']}" class="item-content item-link external">
						<div class="item-inner">
							<div class="item-title">
								<img src="{MODULE_URL}resource/app/img/goods.png" alt="" />
								{$row['title']}
							</div>
						</div>
					</a>
				</li>
				{/loop}
			</ul>
		</div>
		{/if}
		<div class="list-block">
			<ul>
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title">
								<img src="{MODULE_URL}resource/app/img/clock-grey.png" alt="" />
								{$store['business_hours_cn']}
							</div>
						</div>
					</div>
				</li>
				<li>
					<a href="http://api.map.baidu.com/marker?location={$store['location_x']},{$store['location_y']}&title=我的位置&content={$store['address']}&output=html" class="item-content item-link external">
						<div class="item-inner">
							<div class="item-title">
								<img src="{MODULE_URL}resource/app/img/location-grey.png" alt="" />
								{$store['address']}
							</div>
						</div>
					</a>
				</li>
				<li>
					<a href="tel:{$store['telephone']}" class="item-content item-link external">
						<div class="item-inner">
							<div class="item-title">
								<img src="{MODULE_URL}resource/app/img/tel-grey.png" alt="" />
								{$store['telephone']}
							</div>
						</div>
					</a>
				</li>
				{if !empty($store['sns']['qq'])}
				<li>
					<a href="http://wpa.qq.com/msgrd?v=3&uin={$store['sns']['qq']}&site=qq&menu=yes" class="item-content item-link external">
						<div class="item-inner">
							<div class="item-title">
								<span><i class="fa fa-qq"></i></span>
								{$store['sns']['qq']}
							</div>
						</div>
					</a>
				</li>
				{/if}
				{if !empty($store['sns']['weixin'])}
				<li>
					<a href="javascript:;" class="item-content item-link external">
						<div class="item-inner">
							<div class="item-title">
								<span><i class="fa fa-weixin"></i></span>
								{$store['sns']['weixin']}
							</div>
						</div>
					</a>
				</li>
				{/if}
				{if !empty($store['notice'])}
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title text">
								<img src="{MODULE_URL}resource/app/img/voice-grey.png" alt="" />
								{$store['notice']}
							</div>
						</div>
					</div>
				</li>
				{/if}
				{if !empty($store['description'])}
				<li>
					<a href="javascript:;" class="item-content item-link external open-popup" data-popup=".popup-store-description">
						<div class="item-inner">
							<div class="item-title">
								<span><i class="fa fa-weixin"></i></span>
								门店特色
							</div>
						</div>
					</a>
				</li>
				{/if}
			</ul>
		</div>
		<div class="list-block">
			<ul>
				{if $activity['first_order_status'] == 1}
					<li>
						<div class="item-content">
							<div class="item-inner">
								<div class="item-title">
									<img src="{MODULE_URL}resource/app/img/xin_b.png" alt="" />
									新用户在线支付
									{loop $activity['first_order_data'] $first}
									满{$first['condition']}元减{$first['back']}
									{/loop}
								</div>
							</div>
						</div>
					</li>
				{/if}
				{if $activity['discount_status'] == 1}
					<li>
						<div class="item-content">
							<div class="item-inner">
								<div class="item-title">
									<img src="{MODULE_URL}resource/app/img/jian_b.png" alt="" />
									在线支付
									{loop $activity['discount_data'] $discount}
									满{$discount['condition']}元减{$discount['back']}
									{/loop}
								</div>
							</div>
						</div>
					</li>
				{/if}
				{if $activity['grant_status'] == 1}
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title">
								<img src="{MODULE_URL}resource/app/img/zeng_b.png" alt="" />
								在线支付
								{loop $activity['grant_data'] $grant}
								满{$grant['condition']}元赠{$grant['back']}
								{/loop}
							</div>
						</div>
					</div>
				</li>
				{/if}
				{if $activity['collect_coupon_status'] == 1}
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title">
								<img src="{MODULE_URL}resource/app/img/coupon_b.png" alt="" />
								进店可领取代金券
							</div>
						</div>
					</div>
				</li>
				{/if}
				{if $store['delivery_free_price'] > 0}
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title">
								<img src="{MODULE_URL}resource/app/img/mian_b.png" alt="" />
								下单满{$store['delivery_free_price']}元免配送费
							</div>
						</div>
					</div>
				</li>
				{/if}
			</ul>
		</div>
		<div class="list-block">
			<ul>
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title">
								<img src="{MODULE_URL}resource/app/img/pay_b.png" alt="" />
								支持在线支付
							</div>
						</div>
					</div>
				</li>
				{if $store['invoice_status'] == 1}
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title">
								<img src="{MODULE_URL}resource/app/img/invoice_b.png" alt="" />
								支持使用代金券抵付现金
							</div>
						</div>
					</div>
				</li>
				{/if}
			</ul>
		</div>
		<div class="report">
			<a href="{php echo $this->createMobileUrl('report', array('sid' => $sid));}">举报商家</a>
		</div>
	</div>
</div>

<div class="popup popup-store-description">
	<div class="page">
		<header class="bar bar-nav common-bar-nav">
			<h1 class="title">门店特色</h1>
			<button class="button button-link button-nav pull-right close-popup">关闭</button>
		</header>
		<div class="content" style="background: #FFF">
			<div class="content-padded">
				{$store['description']}
			</div>
		</div>
	</div>
</div>

<script>
$(function(){
	$(document).on('click', '.swiper-slide', function(){
		var url = $(this).data('link');
		if(url) {
			location.href = url;
		}
	});
	$(document).on('click', '#scanqrcode', function(){
		$.confirm("如果您已经到店,请点击'扫码下单'并扫描桌子上的二维码进行店内下单", function(){
			wx.ready(function(){
				wx.scanQRCode({
					needResult: 0, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
					scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
					success: function (res) {
						var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
					}
				});
			});
		});
	});
});
</script>
{template 'common'}
{template 'footer'}